//
//  HistoryViewController.m
//  Work
//
//  Created by Apple on 15/12/16.
//  Copyright © 2015年 mohekeji. All rights reserved.
//

#import "HistoryViewController.h"
#import "NowViewController.h"
#import "JRSegmentViewController.h"
#import "JRSegmentControl.h"
@interface HistoryViewController ()
{
    NSArray * dataSource;
}
@end

@implementation HistoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    NowViewController * one = [storyboard instantiateViewControllerWithIdentifier:@"Now"];
    HistoryViewController * two = [storyboard instantiateViewControllerWithIdentifier:@"Story"];
    JRSegmentViewController * vc = [[JRSegmentViewController alloc]init];
    vc.viewControllers = @[one,two];
    [vc setTitles:@[@"热点", @"聚焦"]];
    vc.segmentBgColor = [UIColor colorWithRed:18.0f/255 green:50.0f/255 blue:110.0f/255 alpha:1.0f];
    vc.indicatorViewColor = [UIColor yellowColor];
    dataSource = @[
                   @{@"title":@"康拜基",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"},
                   @{@"title":@"康拜因",@"content":@"云南丽江大石桥镇123号",@"imageView":@"农机"}];
    // Do any additional setup after loading the view from its nib.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return dataSource.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
    NSDictionary * dic = [dataSource objectAtIndex:indexPath.row];
    cell.textLabel.text = dic[@"title"];
    cell.detailTextLabel.text = dic[@"content"];
    cell.imageView.image = [UIImage imageNamed:dic[@"imageView"]];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 120;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
